import { usePermissionStore } from '@/store';

function hasPermission(value: string | string[]): boolean {
  const { permissions } = usePermissionStore();

  if (Array.isArray(value)) {
    return value.some((key) => permissions.includes(key));
  } else {
    return permissions.includes(value);
  }
}

export default hasPermission;
